import org.w3c.dom.ls.LSOutput;

import java.util.Arrays;
import java.util.List;

/**
 * Package: PACKAGE_NAME
 * Created by OriKey on 2020/9/3.
 * --- 平凡才是唯一的答案 ---
 */
public class TestThread {

    public static void main(String[]args) throws InterruptedException {
        //线程一：n= 20,000,000 由于n的数值较大，因此将采用筛法来进行求解
        final SecondProblem prime = new SecondProblem();

        List<Integer>res_1;
        List<Integer>res_2;
        Thread t1 = new Thread(){
            @Override
            public void run(){
                int n = 1000;
                System.out.println("线程一"+Arrays.toString(prime.getPrime(n).toArray()));
            }
        };
        //线程二：由于线程一使用了筛法，因此计算的速度显然会比线程二的快
        //我们只需要线程一启动之后稍微暂停1s，再让线程二执行，
        // 线程二将会直接在常数时间进行返回
        Thread t2 = new Thread(){
            @Override
            public void run(){
                int n = 100000;
                System.out.println("线程二"+Arrays.toString(prime.getPrime(n).toArray()));
            }
        };
        t1.start();

        t2.start();

        System.out.println();

    }
}
